﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QNetworkAccessManager>
#include<QNetworkReply>
#include<QNetworkRequest>
#include<QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include<QJsonParseError>
#include<QVector>
#include<QStandardItemModel>
#include "customdelegate.h"
#include "mysql.h"
#include<QFile>
#include<QTextStream>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE


struct weather
{
    QString date;
    QString city;
    QString quality;
    QString wendu;
    forecast *yesterday;
    QVector<forecast*> fore_15;
    weather(QString d1,QString c1,QString q1,QString w1,forecast *y1,QVector<forecast*> f15)
    {
        date=d1;
        city=c1;
        quality=q1;
        wendu=w1;
        yesterday=y1;
        fore_15=f15;
    }
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();
    void on_net_finished(QNetworkReply *reply);
    void parse_json(QByteArray json);
private:
    Ui::MainWindow *ui;
    QNetworkAccessManager *net;
    weather *alldata;
    QStandardItemModel *model;
    myDelegate *delegate;
    mySql *sql;
};
#endif // MAINWINDOW_H
